package com.weixiaodong.ModelDesign.适应设计模式.Iterator模式.遍历书籍程序案例演示;

public class main {
    public static void main(String[] args) {
        BookShelf bookShelf = new BookShelf(5);
        bookShelf.appendBook(new Book("西游记"));
        bookShelf.appendBook(new Book("红楼梦"));
        bookShelf.appendBook(new Book("三国演绎"));
        bookShelf.appendBook(new Book("水浒传"));
        bookShelf.appendBook(new Book("老人与海"));
        bookShelf.appendBook(new Book("假如给我三天光明"));
        Iterator iterator = bookShelf.iterator();
        while (iterator.hasNext()) {
            Book next = (Book) iterator.next();
            System.out.println(next.getBookName());
        }
    }
}
